bpo-44515: handle non-refcounted GC in contextlib tests#26910
Merged
ambv merged 3 commits intoJul 26, 2021
Conversation
| a = weakref.ref(a) | ||
| b = weakref.ref(b) | ||
| # Allow test to work with a non-refcounted GC | ||
| gc.collect(); gc.collect(); gc.collect() |
Member
There was a problem hiding this comment.
Is there a reason this needs to be done three times?
Contributor
Author
There was a problem hiding this comment.
It ensures references are still cleaned up even if they've made it out of the "recently allocated" generation in a GC that tracks generations.
Before we merge, I want to check the rest of the test suite to see if this is still the recommended practice for forcing collection, or if there'sa helper in test.support these days.
Member
There was a problem hiding this comment.
There is test.support.gc_collect(), which does also do it three times.
Contributor
|
GH-27379 is a backport of this pull request to the 3.10 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 26, 2021
Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit a2c45e5) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
sthagen
added a commit
to sthagen/python-cpython
that referenced
this pull request
Jul 26, 2021
bpo-44515: handle non-refcounted GC in contextlib tests (pythonGH-26910)
ambv
pushed a commit
that referenced
this pull request
Jul 26, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue44515